/**
 * @author Lucas Venezian Povoa <lucasvenez at gmail dot com> 
 */
function Edge() {
	
	var source     = null;
	
	var target     = null;
	
	var label      = null;
	
	var attributes = new Array();
	
	this.setSource = function(s) {
		
		if (s instanceof Graph || s instanceof Node)
			source = s;
		else
			throw "Invalid parameter type.";
	};
	
	this.getSource = function() {
		return source;
	};
	
	this.setTarget = function(t) {
		if (t instanceof Graph || t instanceof Node)
			target = t;
		else
			throw "Invalid parameter type.";
	};
	
	this.getTarget = function() {
		return target;
	};
	
	this.setLabel = function(l) {
		if (typeof l == "number" || typeof l == "boolean" || 
				i instanceof Number || i instanceof Boolean)
			label = l + "";
		
		else if (typeof l == "string" || l instanceof String)
			label = l;
		
		else
			throw "Invalid parameter type.";
		
	};
	
	this.getLabel = function() {
		return label;
	};
	
	this.addAttribute = function(key, value) {
		attributes[key] = value;
	};
	
	this.hasAttribute = function(key) {
		return attributes[key] != undefined;
	};
	
	this.removeAttribute = function(key) {
		
		var result = attributes[key];
		
		if (result != undefined) {
			
			attributes[key] = undefined;
			return result;
			
		} else
			return null;
	};
	
	this.getAttribute = function(key) {
		
		var result = attributes[key];
		
		if (result != undefined)
			return result;
		
		return null;
	};
};